import { computed } from 'vue'

export function useFormState(formDataRef, requiredFieldsRef) {
	const isComplete = computed(() =>
		requiredFieldsRef.value.every(field => {
			const value = formDataRef.value[field]
			return value !== undefined && value !== null && value !== ''
		})
	)

	const buttonType = computed(() =>
		isComplete.value ? 'success' : 'default'
	)

	const buttonPlain = computed(() =>
		isComplete.value
	)

	return {
		buttonType,
		buttonPlain
	}
}